package com.li.manage.exception;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

public class ExceptionHandler implements HandlerExceptionResolver {
	
	private static Logger logger = LoggerFactory.getLogger(ExceptionHandler.class);
	
	public ModelAndView resolveException(HttpServletRequest req, HttpServletResponse resp, 
			Object boj, Exception e) {
		ModelAndView mav = new ModelAndView("/exception/exception");
		mav.addObject("errorMsg", e.getMessage());
		logger.error("异常信息：" + e.getMessage());
		e.printStackTrace();
		return mav;
	}

}
